#ifndef _ENCODE_H_
#define _ENCODE_H_

#include <xvid.h>
#include <math.h>
#include <sys/time.h>
#include <string.h>

#define IMAGE_SIZE(x,y) ((x)*(y)*2)  
  
#define MAX(A,B) ( ((A)>(B)) ? (A) : (B) )  
#define SMALL_EPS (1e-10)  
  
#define SWAP(a) ( (((a)&0x000000ff)<<24) | (((a)&0x0000ff00)<<8) | \
                  (((a)&0x00ff0000)>>8)  | (((a)&0xff000000)>>24) )  
                  
//#define VOP_ELEMENTS (sizeof(vop_presets)/sizeof(vop_presets[0])) 
#define VOP_ELEMENTS 7
//#define ME_ELEMENTS (sizeof(motion_presets)/sizeof(motion_presets[0]))  
#define ME_ELEMENTS 7

#define MAX_ZONES   64
/* Maximum number of frames to encode */  
#define ABS_MAXFRAMENR 9999  
#define DEFAULT_FILE_NAME "/home/cf/tmp/video.avi"
#define FRAMERATE_INCR 1001


#define XDIM  640  
#define YDIM  480 
#define ARG_INPUTTYPE 0
#define ARG_MAXFRAMENR 9999
#define ARG_STATS  0
#define ARG_SAVEINDIVIDUAL 0
#define ARG_SAVEMPEGSTREAM 1
#define ARG_SINGLE 1
#define ARG_QUALITY 0
/* the path where to save output */  
#define filepath  "./"


//function declare----------
/* Encoder related functions */  
int  
enc_init(int use_assembler );
int  
enc_main(unsigned char *image,  
         unsigned char *bitstream,  
         int *key,  
         int *stats_type,  
         int *stats_quant,  
         int *stats_length,  
         int sse[3]);
int  
enc_stop();

/* Statistical functions */  
double msecond();

/* Prints program usage message */  
 void usage();  
#endif                  